class Animal{
    public void fun(){
        System.out.println("动物");
    }
}
class Cat extends Animal{
    @Override
    public void fun() {
        System.out.println("猫");
    }
}
class Dog extends Animal{
    @Override
    public void fun() {
        System.out.println("狗");
    }
}
class Bird extends Animal{
    @Override
    public void fun() {
        System.out.println("鸟");
    }
}
public class Text {
    public static void main(String[] args) {
        Animal[] animals = {new Cat(), new Dog()};
        for (Animal animal : animals) {
            animal.fun();
        }
    }
}





